BASIC DIGITAL LOGIC

 

If you’ve been keeping up with Slot Tech Magazine’s Basic Logic Course you should have a good understanding of basic Gates and Latches. This article picks up from there and continues on emphasizing Hands-on experience. We will review flip flops and latches and build a training station to exercise these devices so we can watch them work and build circuits using them. In my opinion, the best way to understand ICs is to sit down and build a circuit using them. This gives you the base of understanding necessary for troubleshooting them in a circuit.

 

This part of the course is not merely for academic purposes. The circuits we will use to manipulate the Inputs of the ICs and monitor the Outputs of the ICs will be the same (or similar) circuits we will use in designing test fixtures later on in the series. Now that you know where we’ve been and where we’re going, let’s get started on where we are.

 

Gates and simple circuits can be tested with simple switch inputs. We need a resistor to pull the input up to VCC when it isn’t pulled to ground through the switch. TTL outputs are capable of driving enough current to power an LED. 74xxx, 74LSxxx, 74Asxxx, anything that doesn’t have a “C” in it. Inclusion of the “C” in the part number means the IC is actually CMOS technology, not TTL, and may only be able to drive a milliamp, or so, of current. Let’s take a circuit to test basic gates with first.

 


Building the circuits

 

Figure 1 shows basic switch inputs and an LED output to exercise a 7400 2-Input NAND Gate. As we close one of the switches it inputs a low to the input of the 7400 it is connected to. If the output goes low the LED should light. If we remember the 7400, both inputs must be high (switches off) before the output goes low.

 

Figure 1 shows basic switch inputs and an LED output to exercise a 7400 2-Input NAND Gate. As we close one of the switches it inputs a low to the input of the 7400 it is connected to. If the output goes low the LED should light. If we remember the 7400, both inputs must be high (switches off) before the output goes low.

Our first decision is how to accomplish building the circuit. Radio Shack, and quite a few other stores, sell small general purpose circuit boards such as Radio Shack’s 276-168, and 276-150A. (See pictures with these titles.) These are circuit boards etched with a general-purpose pattern. On either you will find rows of copper clad 0.300” apart. Exactly the size of a DIP IC. You will also find long strings of holes running lengthwise for power buses. These are one possibility for building the circuits we will use. For a few more dollars you can get a “Huge IC Socket” type of breadboard. (See picture title “Breadboard”.) The breadboard gives you the flexibility to reuse the board many times. Since our “Basic Input Switches” and “Basic Output LEDs” will be repeatedly used, I suggest building them on the circuit boards, and using the breadboard for the circuit unique to the IC we are going to use in the exercise.

 

 

The picture above is Radio Shack part 276-150A. This board is suitable for projects that have only one or two ICs and a few discrete components. The picture to the right of it is 276-168. This board is more suitable for a circuit with a few ICs or more complex circuits.

 

For more flexibility, a breadboard can be used, as shown below. This is one big IC socket that may be reused. It is arranged in rows of five dots. Each row of five are connected together. If you wish to connect two components together you just plug one end into one connector in that row.

 

Powering the circuits

 

Of course we need to power these circuits somehow. We can use batteries or a power supply. Most TTL and CMOS will work fine off of 4.5 Volts (three 1.5 V batteries). For more safety, we can use a pack of four batteries, giving us 6 Volts, and include a series diode. The diode drops the voltage down closer to 5 V, and prevents damage to the circuit if we should ever connect the batteries in reverse order. Radio Shack sells battery packs that will work just fine. If you would rather run off of wall power you can use a “wall wart” power supply like the kind used to charge cell phones. I have a box full of various kinds I bought from second hand stores for $1.00 each. Ideally, you want one that has a regulated output of 5 Volts at a few hundred milliamps. If you find one that is unregulated you can build a voltage regulator to bring the voltage down to 5 Volts. Unregulated wall warts can be identified by measuring the output voltage and comparing that to what the label says it should be. One that puts out 3.6 Volts and has a current capability of 500 or 600 (or more) milliamps, may measure at up to 8 Volts with no load. As you draw current from it the voltage drops down so that at the rated current you will have the rated voltage. The picture “Power Supply” shows a 7.5 Volt at 800 mA unregulated power supply made for these exercises.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The picture and schematic above give you an idea of the circuit required. Components are not tightly regimented. The LEDs and their resistors are optional. C1 may be anything from a few hundred microfarads to a few thousand microfarads, as long as the voltage rating is higher than the unloaded voltage coming out of the “Wall Wart” supply. C2 also may be anything from 1 microfarad to something less than one hundred microfarads. The wall wart supply must be able to supply more than 7 or 8 Volts at a few hundred milliamps (up to 18 Volts).

 

The 7805 will regulate the voltage coming out of the wall wart down to +5 Volts, as long as the input is above 7 or 8 volts, but not higher than 24 volts.

 

Input Circuit

 

What you use for switches is more a matter of prerogative. Any kind of switch at will do. The cheapest way to go may be a DIP switch. For exercising simple Gates switches are adequate as inputs. When we get to Latches we need cleaner square waves than we can get out of switches alone. When a mechanical switch opens and closes the contacts wipe on one another and bounce. If we could look closely at the signal on an oscilloscope we would see bounces in the signal over milliseconds. For anything besides gates we cannot accept such dirty signals. In order to get clean square waves we can build a “Debouncing” circuit using 7400 gates to build an S-R Latch, or the 74279 is four S-R latches built into one case.

 

 

The above would be a suitable circuit for exercising basic gates. The circuit below will be more appropriate for latches and more complex circuits.

A circuit like this provides a clean (glitch-free) signal for latches, counters, and such.


 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Output circuits

 

From TTL outputs we can get up to 25 mA of output current. From 74xx we can get 16 mA easily. From 74LSxxx we can get a little less, but as long as we are not driving other logic devices that are sensitive to the low level output voltage, we can still drive an LED directly. For these ICs the “Four LED” circuit will work fine.


CMOS devices may only have drive currents of a milliamp or so. For these we need an LED driver that will work on a milliamp or less and drive an LED requiring 10’s of milliamps. For these we need a “Low Current LED Driver”.

 


 

All of these examples were designed for minimal cost. For the cost of lunch you can get started building these circuits. For a more reliable circuit you can use better switches and mount the whole thing in boxes. This is the way we will build the test fixture examples that follow. How you proceed to build your depends on your budget as well as your long term intentions.

 

Using the setup to test a J-K Flip Flop (74107)

 

The 74017 is a popular device. They are easy to get hold of and not expensive. You can get the part from Radio Shack, or most any other distributor, or it is IGT part number 32015590. We will exercise the 74107 one section at a time. There are two in a package. We need four (clean) inputs and two outputs.

 

If we look at the Truth Table for a 74107 we find it to be like this:

 

J           K         Clk       Reset    Q         Q-not

1          0          /           1          1          0          With J high, K low, reset high, on the positive edge of the clock pulse the flip flop should set (Q high, Q-not low).

 

0          1          /           1          0          1          With J low, K high, reset high, on the positive edge of the clock pulse the flip flop should clear (Q low, Q-not high).

 

1          1          /           1          T          T          With J and K high, reset high, on the positive edge of the clock pulse the flip flop should toggle. If it was set it will clear. If it was clear it will set.

 

0          0          /           1          (nc)      (nc)      With J and K low, reset high, on the positive edge of the clock pulse the flip flop should not change. If it was set it should stay set. If it was clear it should stay clear.

x          x          x          0          0          1          With reset low the flip-flop will clear. All synchronous (clock related) operations are inoperative.

 

To test a 74107 we need four inputs from switches and two outputs. Since we have a “Clock” input we need a glitch-free signal from our switch circuits. We can exercise one section of the 74107 at a time.

 

 

 

From testing ICs to testing boards

 

The procedure for testing an IC, as we have just done, is little different if we were to test a board. As long as we know what the board or assembly should do we can exercise it for testing and troubleshooting. In following articles we will use these same, or similar, circuits to test simpler boards, and more on to more complicated assemblies. Among these we can do Coin Comparators of all types, Meter boards, Hoppers and Hopper Control Boards… any board or assembly that only requires a few simple inputs and outputs.

 

Above is an example of a basic, general purpose, four-input and four-output test setup. In order to use the setup to test a certain assembly, all we have to do is make a cable to interface to the assembly to be tested.

 

 

In the schematic above, J2 is the jack coming out of the test setup. J1 is the hopper connector. This cable looks, as shown below.

By making different cables we can test different types of hoppers, VFD Display Assemblies, Coin Comparators… most anything with four inputs and four outputs.